Skip to content

feat(module-07): real-time presence, lobby chat backend - #10

Merged
MohanEhab merged 4 commits into
mainfrom
feature/module-07-realtime-presence-chat
Jul 17, 2026
Merged

feat(module-07): real-time presence, lobby chat backend#10
MohanEhab merged 4 commits into
mainfrom
feature/module-07-realtime-presence-chat

Conversation

@MohanEhab

Copy link
Copy Markdown
Contributor

Summary

  • SignalR presence hub and persistent lobby chat backend for Module 7.
  • Fixes a lobby-lifecycle bug where members were left stranded when a lobby closed or expired.

What changed

  • New RealtimeHub at /hubs/realtime with presence tracking (Online/Away/InLobby/Playing/Offline, 5-connection cap).
  • Persistent lobby chat: 30-day retention, idempotent sends, block-aware delivery (ChatService, ChatRepository, ChatRetentionSweeper).
  • LobbyScopeAuthorizer re-checks lobby membership/auth on every hub method call (not cached); connections close on auth expiration.
  • Outbox-driven LobbyRealtimeHandler broadcasts lobby/chat events.
  • Lobby.Close() now releases all joined members instead of leaving them stranded; broadcasts a readiness-changed event via outbox.
  • New EF Core migration AddChatAndRealtimeActivation.

Tests

  • Unit/integration tests for hub authorization, chat service, retention sweeper, and the two new lobby-lifecycle regression tests (LobbyLifecycleTests).
  • Full suite run and passing at commit time (see docs/modules/module-07-realtime-presence-chat/testing-report.md in SimPle.Project).

Security/docs

  • Security audit closed with no unwaived Critical/High findings: docs/security/audits/module-07-realtime-presence-chat.md (SimPle.Project).
  • Module docs: docs/modules/module-07-realtime-presence-chat/{api-reference,technical-flow,testing-report}.md.

Risks/deferred

  • releaseEligible remains false: containerized/staging deployment evidence and hosted CI are owned by Module 14, not this PR.
  • Formal stage-checkpoint index for this module is only 1/8 entries indexed; owner-waived rather than backfilled (evidence files themselves are complete — see index.json vs security.json/verification.json/production-review.json in SimPle.Project).
  • Two owner-authorized follow-ups tracked but not yet executed: a one-off SQL fix for a stranded lobby row on a real test account, and an E2E self-cleanup improvement (P2) before Module 14 CI.

MohanEhab and others added 4 commits July 13, 2026 09:28
Git's core.autocrlf rewrote line endings on Windows, making a semantically
identical checked-in manifest hash to a different seed revision. Hash the
manifest with canonical LF endings so only real content changes move the
checksum, and cover it with a checksum test.
Adds Dockerfile, CI/CD hardening (SBOM generation, provenance attestation,
NuGet vulnerability gate, container smoke test), CodeQL and dependabot
config, liveness/readiness health checks with a worker-readiness registry,
correlation-id middleware, and structured JSON logging for containers.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…lobby chat backend

Adds an authenticated /hubs/realtime SignalR hub with origin validation,
connection tracking/rate limiting, and per-method scope/suspension/block
rechecks; an in-memory presence registry; and persistent lobby chat
(retention sweeper, idempotency, block-aware delivery) exposed over both
the hub and REST history endpoints.
Lobby.Close/expiry only flipped the lobby's own state and never released
individual LobbyMember rows still at Joined. The partial unique index on
(UserId, Joined) then permanently blocked that user from joining or
creating another lobby, even though the lobby itself was terminal. Found
during module-07 E2E verification; also broadcasts readiness changes over
the outbox so LobbyRealtimeHandler can consume them.

try
{
using (_logger.BeginScope(new Dictionary<string, object?> { ["CorrelationId"] = correlationId }))
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@MohanEhab
MohanEhab merged commit b1b06a7 into main Jul 17, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants